package com.ruoyi.project.web.quesDetail.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.web.quesDetail.mapper.QuesDetailMapper;
import com.ruoyi.project.web.quesDetail.domain.QuesDetail;
import com.ruoyi.project.web.quesDetail.service.IQuesDetailService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 做题记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-02-04
 */
@Service
public class QuesDetailServiceImpl implements IQuesDetailService 
{
    @Autowired
    private QuesDetailMapper quesDetailMapper;

    /**
     * 查询做题记录
     * 
     * @param id 做题记录ID
     * @return 做题记录
     */
    @Override
    public QuesDetail selectQuesDetailById(Long id)
    {
        return quesDetailMapper.selectQuesDetailById(id);
    }

    /**
     * 查询做题记录列表
     * 
     * @param quesDetail 做题记录
     * @return 做题记录
     */
    @Override
    public List<QuesDetail> selectQuesDetailList(QuesDetail quesDetail)
    {
        return quesDetailMapper.selectQuesDetailList(quesDetail);
    }

    /**
     * 新增做题记录
     * 
     * @param quesDetail 做题记录
     * @return 结果
     */
    @Override
    public int insertQuesDetail(QuesDetail quesDetail)
    {
        quesDetail.setCreateTime(DateUtils.getNowDate());
        return quesDetailMapper.insertQuesDetail(quesDetail);
    }

    /**
     * 修改做题记录
     * 
     * @param quesDetail 做题记录
     * @return 结果
     */
    @Override
    public int updateQuesDetail(QuesDetail quesDetail)
    {
        quesDetail.setUpdateTime(DateUtils.getNowDate());
        return quesDetailMapper.updateQuesDetail(quesDetail);
    }

    /**
     * 删除做题记录对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteQuesDetailByIds(String ids)
    {
        return quesDetailMapper.deleteQuesDetailByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除做题记录信息
     * 
     * @param id 做题记录ID
     * @return 结果
     */
    @Override
    public int deleteQuesDetailById(Long id)
    {
        return quesDetailMapper.deleteQuesDetailById(id);
    }

    @Override
    public int insertSomeEntity(String quesIds, long userId, Long examId) {
        String[] ids = Convert.toStrArray(quesIds);
        return quesDetailMapper.insertSomeEntity(ids,userId,examId);
    }
}
